<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>v-bind动态绑定style</title>
    <style>
      div {
        width: 200px;
        height: 200px;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <!-- 1、直接绑定 -->
      <h2 :style="{ 'font-size': '30px' }">我是h2标签</h2>
      <div :style="{ 'background-color': 'pink' }"></div>

      <!-- 2、绑定变量 -->
      <p :style="{ 'font-size': mySize }">我是p标签</p>
    </div>

    <script src="./lib/vue_v2.6.14.js"></script>
    <script>
      const app = new Vue({
        el: '#app',
        data: {
          mySize: '40px'
        }
      });
    </script>
  </body>
</html>
